<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bind</title>
</head>
<body>
    <script>
        function myBind(fn, target, ...args){
            return function(){
                target = target || {};
                target.fn = fn;
                return target.fn(...args);
            }
        }
        function print(x){
            console.log(x);
        }

        var fn = myBind(print, null, 1, 2, 3);
        console.log(fn);
        fn();
    </script>
</body>
</html>